package com.zshy.base.sms.autoconfig;

import com.zshy.base.sms.factory.SmsFactory;
import com.zshy.base.sms.properties.SmsProperties;
import com.zshy.base.sms.service.SmsTypeOperatorRouter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自动装配
 *
 * @author zhouhengzhe
 * @version 1.0
 */
@Slf4j
@Configuration
@EnableConfigurationProperties(SmsProperties.class)
@RequiredArgsConstructor
public class SmsAutoConfiguration {

    private final SmsProperties smsProperties;

    private final SmsTypeOperatorRouter smsTypeOperatorRouter;

    @Bean
    public SmsFactory smsService() {
        return new SmsFactory(smsTypeOperatorRouter, smsProperties);
    }
}
